package com.omkarpatil.learningjpa2.mapping.basic.embedded;

import javax.persistence.EntityManager;

import com.omkarpatil.learningjpa2.util.EntityManagerFactoryFactory;

public class TestDriver {

	public static void main(String[] args) {
		EntityManager em = EntityManagerFactoryFactory.getEntityManagerFactory().createEntityManager();
		em.getTransaction().begin();
		
		Employee emp1 = new Employee();
		emp1.setName("Omkar Patil");
		
		Address addr1 = new Address();
		addr1.setStreet("61, Wellington Road");
		addr1.setCity("Bournemouth");
		addr1.setState("Dorset");
		addr1.setZipCode("BH88JL");
		
		emp1.setAddress(addr1);
		
		em.persist(emp1);
		
		em.getTransaction().commit();
		em.close();

	}

}
